package com.yanqu.road.server.cmd.peakstronghold;

import com.yanqu.road.logic.pb.PlayerBasePb;
import com.yanqu.road.message.YanQuMessage;
import com.yanqu.road.pb.activity.PeakStrongholdWarProto;
import com.yanqu.road.server.cmd.CrossCommand;
import com.yanqu.road.server.cmd.CrossUnionCommand;
import com.yanqu.road.server.command.Cmd;
import com.yanqu.road.server.manager.peakstronghold.CrossPeakStrongholdMgr;
import com.yanqu.road.server.protocol.Protocol;

import java.math.BigInteger;

@Cmd(code = Protocol.C_PEAK_STRONGHOLD_ELIMINATION_MAMMON_HELP, desc = "财神助力")
public class CrossPeakStrongholdMammonHelpCmd extends CrossUnionCommand {

    @Override
    public boolean parseData(YanQuMessage packet) throws Exception {
        return true;
    }

    @Override
    public void execute(YanQuMessage packet) throws Exception {
        PeakStrongholdWarProto.CrossPeakStrongholdMammonHelpReqMsg req = PeakStrongholdWarProto.CrossPeakStrongholdMammonHelpReqMsg.parseFrom(packet.getBytes());
        String targetUnionId = "";
        if (req.hasUnionId()) {
            targetUnionId = req.getUnionId();
        }
        CrossPeakStrongholdMgr.mammonHelp(req.getActivityId(), serverId, packet.getPlayerId(), req.getOwnUnionId(),
                PlayerBasePb.parseToUserBaseInfo(req.getUserBaseInfo()),
                req.getGoodsId(),
                targetUnionId,
                req.getMammonType(),
                new BigInteger(req.getDamage()),
                req.getAttackTimes());
    }

    @Override
    public void sendData() {

    }
}
